1 <?php include ( "../inc/connect.inc.php" ); ?>
2 <?php
3
4 ob_start();
5 session_start();

6 if
(!isset($_SESSION['admin_login'])) {
7     $user =
"";
8     header(
"location: login.php?ono=".$eoid."");
9 }

10 else
{
11     
if (isset($_REQUEST['eoid'])) {
12     
13         $eoid = mysql_real_escape_string($_REQUEST[
'eoid']);
14         $getposts5 = mysql_query(
"SELECT * FROM orders WHERE id='$eoid'") or die(mysql_error());
15             
if (mysql_num_rows($getposts5)){
16
17             }
else {
18                 header(
'location: index.php');
19             }
20     }
else {
21         header(
'location: index.php');
22     }
23     $user = $_SESSION[
'admin_login'];
24     $result = mysql_query(
"SELECT * FROM admin WHERE id='$user'");
25     $get_user_email = mysql_fetch_assoc($result);
26         $uname_db = $get_user_email[
'firstName'];
27
28
29     $result1 = mysql_query(
"SELECT * FROM orders WHERE id='$eoid'");
30         $get_order_info = mysql_fetch_assoc($result1);
31             $eouid = $get_order_info[
'uid'];
32             $eopid = $get_order_info[
'pid'];
33             $eoquantity = $get_order_info[
'quantity'];
34             $eoplace = $get_order_info[
'oplace'];
35             $eomobile = $get_order_info[
'mobile'];
36             $eodstatus = $get_order_info[
'dstatus'];
37             $eodustatus = ucwords($get_order_info[
'dstatus']);
38             $eodate = $get_order_info[
'odate'];
39             $eddate = $get_order_info[
'ddate'];
40
41             $result2 = mysql_query(
"SELECT * FROM user WHERE id='$eouid'");
42             $get_order_info2 = mysql_fetch_assoc($result2);
43             $euname = $get_order_info2[
'firstName'];
44             $euemail = $get_order_info2[
'email'];
45             $eumobile = $get_order_info2[
'mobile'];
46 }
47
48 $getposts = mysql_query(
"SELECT * FROM products WHERE id ='$eopid'") or die(mysql_error());
49                     
if (mysql_num_rows($getposts)) {
50                         $row = mysql_fetch_assoc($getposts);
51                         $id = $row[
'id'];
52                         $pName = $row[
'pName'];
53                         $price = $row[
'price'];
54                         $description = $row[
'description'];
55                         $picture = $row[
'picture'];
56                         $item = $row[
'item'];
57                         $category = $row[
'category'];
58                         $available =$row[
'available'];
59                     }

60
61 //order

62
63 if
(isset($_POST['order'])) {
64 //declere veriable

65 $eodstatus = $_POST[
'dstatus'];
66 $dquantity = $_POST[
'quantity'];
67 $ddate = $_POST[
'ddate'];
68 //triming name

69     
try {
70         
if(empty($_POST['dstatus'])) {
71             
throw new Exception('Status can not be empty');
72             
73         }
74                 
if(mysql_query("UPDATE orders SET dstatus='$eodstatus', ddate='$ddate', quantity='$dquantity' WHERE id='$eoid'")){
75                     
//success message
76                 header(
'location: editorder.php?eoid='.$eoid.'');
77                 $success_message =
'
78                 <div
class="signupform_content"><h2><font face="bookman">Change successfull!</font></h2>
79                 </div>
';
80                 }
81
82     }
83     
catch(Exception $e) {
84         $error_message = $e->getMessage();
85     }
86 }

87 if
(isset($_POST['delorder'])) {
88 //triming name

89     
if(mysql_query("DELETE FROM orders WHERE id='$eoid'")){
90
91     header(
'location: orders.php');
92     }
93
94     }
95 $search_value =
"";
96
97
98 ?>
99
100 <!DOCTYPE html>
101 <html>
102 <head>
103     <title>SAREE</title>
104     <link rel=
"stylesheet" type="text/css" href="../css/style.css">
105     <meta name=
"viewport" content="width=device-width, initial-scale=1">
106 </head>
107 <body style=
"background-image: url(../image/homebackgrndimg1.png);">
108     <div
class="homepageheader">
109             <div
class="signinButton loginButton">
110                 <div
class="uiloginbutton signinButton loginButton" style="margin-right: 40px;">
111                     <?php
112                         
if ($user!="") {
113                             echo
'<a style="text-decoration: none;color: #fff;" href="logout.php">LOG OUT</a>';
114                         }
115                      ?>
116                     
117                 </div>
118                 <div
class="uiloginbutton signinButton loginButton">
119                     <?php
120                         
if ($user!="") {
121                             echo
'<a style="text-decoration: none;color: #fff;" href="login.php">Hi '.$uname_db.'</a>';
122                         }
123                         
else {
124                             echo
'<a style="text-decoration: none;color: #fff;" href="login.php">LOG IN</a>';
125                         }
126                      ?>
127                 </div>
128             </div>
129             <div style=
"float: left; margin: 5px 0px 0px 23px;">
130                 <a href=
"index.php">
131                     <img style=
" height: 75px; width: 130px;" src="../image/ebuybdlogo.png">
132                 </a>
133             </div>
134             <div id=
"srcheader">
135                 <form id=
"newsearch" method="get" action="search.php">
136                         <?php
137                             echo
'<input type="text" class="srctextinput" name="keywords" size="21" maxlength="120" placeholder="Search Here..." value="'.$search_value.'"><input type="submit" value="search" class="srcbutton" >';
138                          ?>
139                 </form>
140             <div
class="srcclear"></div>
141             </div>
142         </div>
143         <div
class="categolis">
144             <table>
145                 <tr>
146                     <th>
147                         <a href=
"index.php" style="text-decoration: none;color: #fff;padding: 4px 12px;background-color: #c7587e;border-radius: 12px;">Home</a>
148                     </th>
149                     <th><a href=
"addproduct.php" style="text-decoration: none;color: #ddd;padding: 4px 12px;background-color: #c7587e;border-radius: 12px;">Add Product</a></th>
150                     <th><a href=
"newadmin.php" style="text-decoration: none;color: #ddd;padding: 4px 12px;background-color: #c7587e;border-radius: 12px;">New Admin</a></th>
151                     <th><a href=
"allproducts.php" style="text-decoration: none;color: #ddd;padding: 4px 12px;background-color: #c7587e;border-radius: 12px;">All Products</a></th>
152                     <th><a href=
"orders.php" style="text-decoration: none;color: #ddd;padding: 4px 12px;background-color: #24bfae;border-radius: 12px;">Orders</a></th>
153                 </tr>
154             </table>
155         </div>
156     <div
class="holecontainer" style=" padding-top: 20px; padding: 0 20%">
157         <div
class="container signupform_content ">
158             <div>
159                 <h2 style=
"padding-bottom: 20px;">Change Delevary Status</h2>
160                 <div style=
"float: right;">
161                 <?php
162                     echo
'
163                         <div
class="">
164                         <div
class="signupform_text"></div>
165                         <div>
166                             <form action=
"" method="POST" class="registration">
167                                 <div
class="signup_form" style=" margin-top: 38px;">
168                                     <div>
169                                         <td>
170                                             <input name=
"ddate" placeholder="Delevary date" required="required" class="email signupbox" type="date" size="30" value="'.$eddate.'">
171                                         </td>
172                                     </div>
173                                     <div>
174                                         <td>
175                                             <
select name="dstatus" required="required" style=" font-size: 20px;
176                                                 font-style: italic;margin-bottom: 3px;margin-top: 0px;padding: 14px;line-height: 25px;border-radius: 4px;border: 1px solid #
169E8F;color: #169E8F;margin-left: 0;width: 300px;background-color: transparent;" class="">
177                                                         <option selected
value="'.$eodstatus.'">'.$eodustatus.'</option>
178                                                         <option
value="No">No</option>
179                                                         <option
value="Yes">Yes</option>
180                                                         <option
value="Cancel">Cancel</option>
181                                                     </
select>
182                                         </td>
183                                     </div>
184                                     <div>
185                                         <td>
186                                             <
select name="quantity" required="required" style=" font-size: 20px;
187                                         font-style: italic; margin-bottom: 3px;margin-top: 0px;padding: 14px;line-height: 25px;border-radius: 4px;border: 1px solid #
169E8F;color: #169E8F;margin-left: 0;width: 300px;background-color: transparent;" class="">
188                                         <option selected
value="'.$eoquantity.'">Quantity: '.$eoquantity.'</option>';
189                                                 ?><?php
190                                                 
for ($i=1; $i<=$available; $i++) {
191                                                     echo
'<option value="'.$i.'">Quantity: '.$i.'</option>';
192                                                 }
193                                             ?>
194                                             <?php echo
'
195                                             </
select>
196                                         </td>
197                                     </div>
198                                     <div>
199                                         <input name=
"order" class="uisignupbutton signupbutton" type="submit" value="Confirm Change">
200                                     </div>
201                                     <div>
202                                         <input name=
"delorder" class="uisignupbutton signupbutton" type="submit" value="Delete Order">
203                                     </div>
204                                     <div
class="signup_error_msg"> '; ?>
205                                         <?php
206                                             
if (isset($error_message)) {echo $error_message;}
207                                             
208                                         ?>
209                                     <?php echo
'</div>
210                                 </div>
211                             </form>
212                             
213                         </div>
214                     </div>
215
216                     
';
217                     
if(isset($success_message)) {echo $success_message;}
218
219                  ?>
220                     
221                 </div>
222             </div>
223         </div>
224         <div style=
"float: left;">
225             <div>
226                 <?php
227                     echo
'
228                         <ul style=
"float: left;">
229                             <li style=
"float: left; padding: 0px 25px 25px 25px;">
230                                 <div
class="home-prodlist-img">
231                                     <img src=
"../image/product/'.$item.'/'.$picture.'" class="home-prodlist-imgi">
232                                     
233                                     <div style=
"text-align: center; padding: 0 0 6px 0;">'.$pName.'</div>
234                                 </div>
235                                 
236                             </li>
237                         </ul>
238                     
';
239                 ?>
240             </div>
241
242         </div>
243     </div>
244 </body>
245 </html>


Gõ tìm kiếm nhanh...